#
# Partisan Mod
# ViSaPartisanEventManager
# 

from CvPythonExtensions import *
import CvUtil

import CvEventManager
import sys
import PyHelpers
import CvCameraControls
import Partisan
import CvConfigParser


gc = CyGlobalContext()	
Partisan = Partisan.adPartisan()
PyPlayer = PyHelpers.PyPlayer

def loadConfigurationData():

	global g_bPartisanEnable
	g_bPartisanEnable = False

	# loads the ViSa Component Control ini file
	config = CvConfigParser.CvConfigParser("ViSa-Component-Control.ini")

	# If we actually were able to open the "ViSa-Component-Control.ini" file then read in the values.
	# otherwise we'll keep the default values that were set at the top of this file.
	if(config != None):
		g_bPartisanEnable = config.getboolean("ViSa Component Control","Partisan allowed", False)

	
# globals
###################################################
class CvPartisanEventManager:
	def __init__(self, eventManager):
		# initialize base class

		loadConfigurationData()

		eventManager.addEventHandler("cityAcquired", self.onCityAcquired)

		
	def onCityAcquired(self, argsList):

		if ( g_bPartisanEnable ):
			Partisan.doCityAcquired(argsList)

#		self.parent.onCityAcquired(self, argsList)



